package com.system.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.base.common.service.CrudService;
import com.system.dao.OrgMenuMapper;
import com.system.model.OrgMenu;
import com.system.model.UserLoginInfo;
import com.system.service.OrgMenuService;

@Service
public class OrgMenuServiceImpl extends CrudService<OrgMenuMapper, OrgMenu>
		implements OrgMenuService {

	public List<OrgMenu> findOrgMenuListByUserId(String userId) throws Exception {
		Map<String, String> params = new HashMap<String, String>();
		params.put("userId", userId);
		String sql = "SELECT m.* from org_menu m, org_role_menu t, org_user_role r " +
				"where r.role_id = t.role_id and t.menu_id = m.id and r.user_id = #{userId} and m.del_flag = 0 " +
				"ORDER BY m.menu_no ";
		List<OrgMenu> orgMenuList = this.getList(sql, OrgMenu.class, params);
		return orgMenuList;
	}

}
